﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SundUnderviser.ModelLayer;
using SundUnderviser.ControlLayer;

namespace SundUnderviser.GUILayer
{
    public partial class LabForm : Form
    {
        private Patient selectedPatient;
        public LabForm(Patient patient)
        {
            InitializeComponent();
            selectedPatient = patient;
            labelAktuelPatient.Text = selectedPatient.Navn;
        }

        private void LabForm_Load(object sender, EventArgs e)
        {

        }

        private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void label13_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            String dato = dateTimePicker1.Text.ToString();
            DateTime dato1 = new DateTime();
            dato1 = DateTime.Parse(dato);
            string hermoglobin = textBox1.Text.ToString();
            string leukocytter = textBox5.Text.ToString();
            string thrombocytter = textBox8.Text.ToString();
            string vagt = "DV";
            string koagulationsfakor = textBox13.Text.ToString();
            string ph = textBox16.Text.ToString();
            string baseexcess = textBox18.Text.ToString();
            string oxygen = textBox9.Text.ToString();
            string hydrogencarbonation = textBox22.Text.ToString();
            string kaliumion = textBox25.Text.ToString();
            string natriumion = textBox28.Text.ToString();
            string creatinium = textBox31.Text.ToString();
            string carbamid = textBox34.Text.ToString();
            string albumin = textBox37.Text.ToString();
            string cReakticprotein = textBox40.Text.ToString();
            string glykose6 = textBox46.Text.ToString();
            string glykose12 = textBox49.Text.ToString();
            string glykose17 = textBox45.Text.ToString();
            string glykose21 = textBox50.Text.ToString();
            DateTime pDato = selectedPatient.IndDato;

            PatientControler ctrlObj = new PatientControler();
            int rc = ctrlObj.GemLabSkema(dato1, selectedPatient.Nr, vagt, hermoglobin, leukocytter,
                                           thrombocytter, koagulationsfakor, ph, baseexcess,
                                           oxygen, hydrogencarbonation, kaliumion, natriumion,
                                           creatinium, carbamid, albumin, cReakticprotein,
                                           glykose6, glykose12, glykose17, glykose21, pDato);
            blankfelter();
        }

        private void blankfelter()
        {

            textBox1.Text = "";
            textBox5.Text = "";
            textBox8.Text = "";
            textBox13.Text = "";
            textBox16.Text = "";
            textBox18.Text = "";
            textBox9.Text = "";
            textBox22.Text = "";
            textBox25.Text = "";
            textBox28.Text = "";
            textBox31.Text = "";
            textBox34.Text = "";
            textBox37.Text = "";
            textBox40.Text = "";
            textBox46.Text = "";
            textBox49.Text = "";
            textBox45.Text = "";
            textBox50.Text = "";
        }
    }
}
